﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Empty.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="Ornament.Web" %>
<asp:Content ID="changePasswordContent" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">

        $(document).ready(function() {
            $("#ChangePasswordButton").click(changePassword);
            shortcut.add("enter",changePassword);

        });
        
        function changePassword()
        {

            var data = {
                CurrentPassword: $("#currentPassword").val(),
                NewPassword: $("#newPassword").val(),
                ConfirmPassword: $("#confirmPassword").val(),
                User:"<%=OrnamentContext.Current.CurrentUser.Id%>"
            };
            
            
            $.post('<%=Url.Action("ChangePassword")%>',data,function(result){                        
                alert(result.Message);
            });
                  
        }
        
    </script>
    <p>
        新的密码至少需要
        <%=Html.Encode(ViewData["PasswordLength"])%>
        位长度
    </p>
    <div>
        <fieldset class="cssform">
            <legend>
                <%=Html.GetResourceString("title")%></legend>
            <p>
                <label for="currentPassword">
                    <%=Resources.Basic.old_password%></label>
                <%= Html.Password("currentPassword") %>
                <%= Html.ValidationMessage("currentPassword") %>
            </p>
            <p>
                <label for="newPassword">
                    <%=Resources.Basic.new_password%></label>
                <%= Html.Password("newPassword") %>
                <%= Html.ValidationMessage("newPassword") %>
            </p>
            <p>
                <label for="confirmPassword">
                    <%=Html.GetResourceString("input_password_again")%></label>
                <%= Html.Password("confirmPassword") %>
                <%= Html.ValidationMessage("confirmPassword") %>
            </p>
            <p>
                <input id="ChangePasswordButton" type="button" value="<%=Resources.Basic.OK %>" />
            </p>
        </fieldset>
    </div>
</asp:Content>
